import { Injectable, Inject } from '@angular/core';
import { HttpClient, HttpHeaders,HttpParams  } from '@angular/common/http';
import { Quotes } from '../domain/quote.model';
import { Observable } from 'rxjs';
@Injectable()
export class QuoteService {

  constructor(private http:HttpClient, @Inject('BASE_CONFIG') private config) { }
  private headers = new HttpHeaders({
    'Content-Type':'application/json',
    'x-access-token':localStorage.getItem('token')?localStorage.getItem('token') :''
  });
  getQuote():Observable<Quotes>{
    const uri = `${this.config.uri}/quotes/${Math.floor(Math.random()*10)}`;
    return this.http.get<Quotes>(uri,{headers:this.headers});
  } 
}
